package com.example.emos.api.controller.form.userform;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * @author keying
 * @create 2024--05--14
 */
@Data
@Schema(description = "查询用户分页记录表单")
public class SearchUserByPageForm {
    //page
    @NotNull(message = "page不能为空")
    @Min(value = 1,message = "page不能小于1")
    @Schema(description = "页数")
    private Integer page;

    //length
    @NotNull(message = "length不能为空")
    @Range(min = 10,max = 50,message = "length必须在10到50之间")
    @Schema(description = "每页记录数")
    private Integer length;


    //name
    //[\u4e00-\u9fa5] 基本汉字的编码
    @Pattern(regexp = "^[\\u4e00-\\u9fa5]{1,10}", message = "name内容不正确")
    @Schema(description = "姓名")
    private String name;

    //sex
    @Pattern(regexp = "^男$|^女$}",message = "sex内容不正确")
    @Schema(description = "性别")
    private String sex;

    //role
    @Pattern(regexp = "^[a-zA-Z0-9\\u4e00-\\u9fa5]{2,10}$",message = "role内容不正确")
    @Schema(description = "角色")
    private String role;

    //deptId
    @Min(value = 1,message = "deptId不能小于1")
    private Integer deptId;

    //status
    @Min(value = 1,message = "status不能小于1")
    private Integer status;
}
